
<div class="center">
	<div class="home">
    	<div class="home_left">
        	<?php echo $this->partial('member/menu.phtml',array('uCount' => $this->uCount,'menuId'=>$this->menuId,'user'=>$this->user,'account'=>$this->account)); ?>
        </div>
    	<div class="home_right">
			<div class="waybill">
				<div class="wbweizhi">
                	 <a href="/member/home">我的个人中心</a><span>&gt;</span><a href="/member/waybill">我的国际运单</a><span>&gt;</span>运单详情
                </div>
                <?php
                    if($this->waybill->problem != Application_Model_wayBillItem::Problem_Cancel){
                    switch ($this->waybill->Status){
                    case Application_Model_wayBillItem::STATUS_WaitPay:
                ?>
                    <div class="wbtop">
                        <div class="toptishi">
                            <h1>当前运单状态：待付款</h1>
                            <p>完成您的运单还差一步，请立即支付，请在48小时内付清款项，否则运单会自动取消。</p>
                        </div>                    
                        <div class="topcz">
                            <ul>
                                <li><a class="waybillfk" href="/pay/paying/type/3/id/<?php echo $this->waybill->id;?>">立即付款</a></li>
                                <li><a class="cx" href="<?php echo "/member/waybill/?oper=cancel&id=".($this->waybill->id);?>">撤销订单</a></li>
                            </ul>
                        </div>                    
                    </div>                 
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_Processing:
                ?>
                    <div class="wbtop">
                        <div class="toptishi">
                            <h1>当前运单状态：己付款，等待受理</h1>
                            <p>正在等待受理，一旦受理完成，将不能撤消运单</p>
                        </div>                    
                        <div class="topcz">
                            <ul>
                                <li><a class="cx" href="<?php echo "/member/waybill/?oper=cancel&id=".($this->waybill->id);?>">撤销订单</a></li>
                                <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?><li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li><?php } ?>
                            </ul>
                        </div>                    
                    </div>           
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_Confrimed:
                ?>
                        <div class="wbtop">
                            <div class="toptishi">
                                <h1>当前运单状态：已经受理</h1>
                                <p>您的运单已受理,正在准备为您发货，请稍候。</p>
                            </div>
                            <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?>
                            <div class="topcz">
                                <ul>
                                    <li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li>
                                </ul>
                            </div> 
                            <?php } ?>
                        </div>                
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_Sended:
                ?>
                        <div class="wbtop">
                            <div class="toptishi">
                                <h1>当前运单状态：运单正在发送途中...</h1>
                                <p>您的运单已发送，请耐心等待，如有疑问请联系悠奇客服。</p>
                            </div>
                            <div class="topcz">
                                <ul>
                                    <li><a class='waybillQR' href='javascript:void(0)' name='".($item->id)."'>确认收货</a></li>
                                    <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?><li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li><?php } ?>
                                </ul>
                            </div>
                        </div>                
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_Complated:
                ?>
                        <div class="wbtop">
                            <div class="toptishi">
                                <h1>当前运单状态：已确认收货</h1>
                                <p>如果没有收到货，或收到货后出现问题，请联系悠奇客服。</p>
                            </div>
                            <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?>
                            <div class="topcz">
                                <ul>
                                    <li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li>
                                </ul>
                            </div> 
                            <?php } ?>
                        </div>      
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_ExpressBack:
                ?>
                        <div class="wbtop">
                            <div class="toptishi">
                                <h1 style='color: #c00;'>当前运单状态：问题包裹</h1>
                                <p>您的运单存在问题无法正常发送！</p>
                            </div>
                            <div class="topcz">
                                <ul>
                                    <li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>在线处理问题</a></li>
                                </ul>
                            </div>
                        </div>  
                <?php
                        break;
                    case Application_Model_wayBillItem::STATUS_Launch:
                ?>
                        <div class="wbtop">
                            <div class="toptishi">
                                <h1 style='color: #c00;'>当前运单状态：未启用</h1>
                                <p>您的上门取件的包裹还未到悠奇仓库，所以无法启用您提交的国际运单，如有疑问请联系悠奇客服</p>
                            </div>
                        </div>  
                <?php
                        break;
                    default :
                ?>
                <div class="wbtop">
                    <div class="toptishi">
                        <h1 class="hong">当前运单状态：<?= $this->waybill->getStatusName() ?></h1>
                        <p>您的运单可能存在敏感物品未能出关，如有疑问请联系悠奇客服。</p>
                    </div>
                    <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?>
                        <div class="topcz">
                            <ul>
                                <li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li>
                            </ul>
                        </div> 
                    <?php } ?>
                </div>          
                <?php
                        break;
                        }
                    } else {
                ?>
                       <div class="wbtop">
                            <div class="toptishi">
                                <h1 style='color: #c00;'>当前运单状态：已取消</h1>
                                <p>您的运单已经取消，如有疑问请联系悠奇客服</p>
                            </div>
                            <?php if($this->waybill->problem>Application_Model_wayBillItem::Problem_default){?>
                            <div class="topcz">
                                <ul>
                                    <li><a class="ydwt" href="javascript:void(0)" id='problem_houtai'><i></i>问题运单处理进度</a></li>
                                </ul>
                            </div> 
                            <?php } ?>
                        </div>
                <?php
                    }
                ?>
                <div class="wuliuxinxi">
                    <div class="wayname"><h2>物流信息</h2></div>
                    <div class="wuliuinfo">
                        <table>
                            <tr>
                                <td class="l1">悠奇运单编号：</td>
                                <td class="l2"><?php echo $this->waybill->billNo;?></td>
                                <td class="l1">提交时间：</td>
                                <td class="l2"><?php echo $this->waybill->dateCreated?></td>
                            </tr>
                            <tr>
                                <td class="l1">是否去掉包装：</td>
                                <td class="l2"><?= $this->waybill->IsNoSkin?'去掉':'否' ?></td>
                                <td class="l1">是否去掉吊牌：</td>
                                <td class="l2"><?= $this->waybill->IsNoLogo?'去掉吊牌(费用:+'. $this->waybill->getFeeByType(Application_Model_FeeType::RemovalFee) .'元)':'否' ?></td>
                            </tr>
                            <tr>
                                <td class="l1">是否真空包装：</td>
                                <td class="l2"><?= $this->waybill->IsCompress?'要真空(费用:+'. $this->waybill->getFeeByType(Application_Model_FeeType::VacuumSeviceFee) .'元)':'否' ?></td>
                                <td class="l1">是否护角加固：</td>
                                <td class="l2"><?= $this->waybill->IsWooden?'要护角加固(费用:+'. $this->waybill->getFeeByType(Application_Model_FeeType::WoodenFee) .'元)':'否' ?></td>
                            </tr>
                            <tr>
                                <td class="l1">是否防震：</td>
                                <td class="l2" colspan="3">
                                    <?php echo ($this->waybill->getFeeByType(Application_Model_FeeType::FragileFee) > 0)?"加防震服务（费用:+".$this->waybill->getFeeByType(Application_Model_FeeType::FragileFee)."元）":"否";?>
                                </td>
                            </tr>
                            
                            <tr>
                                <td class="l1">运送方式：</td>
                                <td class="l2"><?php echo $this->waybill->ExpressBy->Name ?></td>
                                <td class="l1">物品净重：</td>
                                <td class="l2"><?= $this->waybill->getWeightByType(Application_Model_WeightType::EstimateWeight) ?>g</td>
                            </tr>
                            <tr>
                                <td class="l1">预付重量：</td>
                                <?php 
                                    $EstimateIsVolume = ($this->waybill->getWeightByType(Application_Model_WeightType::EstimateVolume)>$this->waybill->getWeightByType(Application_Model_WeightType::EstimateWeight))?true:false;
                                ?>
                                <td class="l2"><?= $this->waybill->IsVolume?($EstimateIsVolume?$this->waybill->getWeightByType(Application_Model_WeightType::EstimateVolume):$this->waybill->getWeightByType(Application_Model_WeightType::EstimateWeight)):$this->waybill->getWeightByType(Application_Model_WeightType::EstimateWeight) ?>g<span>
                                <?= $this->waybill->IsVolume?($EstimateIsVolume?'(按预估体积重量)':'(按预估包裹重量)'):'(按预估包裹重量)' ?> </span></td>
                                <td class="l1">预付运费：</td>
                                <td class="l2">￥<?= $this->waybill->getFeeByType(Application_Model_FeeType::EstimateShipFee) ?><span>（多收金额会退至您的帐户）</span></td>  
                            </tr>
                            <tr>
                                <td class="l1">申报价值：</td>
                                <td class="l2"><?= $this->waybill->getFeeByType(Application_Model_FeeType::ReprotValue)>0?'$'.$this->waybill->getFeeByType(Application_Model_FeeType::ReprotValue).' USD':'未填写' ?></td>
                                <td class="l1">投保价值：</td>
                                <td>
                                <?php 
                                    $premiumFee = $this->waybill->getFeeByType(Application_Model_FeeType::RatePremiumFee);
                                    if($premiumFee > 0){
                                        echo '￥'.$this->waybill->getFeeByType(Application_Model_FeeType::PremiumValue).'元(保费:'. $premiumFee .'元)';
                                    }else{
                                        echo '未投保';
                                    }
                                ?>
                                </td>
                            </tr>
                            <tr>
                                <td class="l1">预付总计：</td>
                                <td class="l2">￥<?= $this->waybill->getFeeByType(Application_Model_FeeType::EstimateSum) ?></td>
                                <td class="l1">付款时间：</td>
                                <td class="l2"><?= $this->waybill->DatePaid ?></td>
                            </tr>
                            <tr>
                                <td class="l1">收货地址：</td>
                                <td colspan="3" class="l3"><?php echo $this->waybill->consignee.'，'.$this->waybill->conTel.'，'.$this->waybill->conAdd.'，'.$this->waybill->conPostCode;?></td>
                            </tr>
                        </table>
                    </div>
                    
                    <div class="wayname"><h2>运单发货信息</h2></div>
                    <div class="fahuo">
                    	<table>
                        	<tr>
                            	<td class="l1"><?= $this->waybill->ExpressBy->Name ?>单号：</td>
                            	<td class="l2"><?= $this->waybill->logistics?$this->waybill->logistics :'<i>待定</i>' ?></td>
                            	<td class="l1">发货日期：</td>
                            	<td class="l2"><?= $this->waybill->DateSend?$this->waybill->DateSend:'<i>未发货</i>' ?> </td>
                            </tr>
                        	<tr>
                            	<td class="l1">实际结算重量：</td>
                                <td class="l2">
                                <?php 
                                    $LastIsVolume = ($this->waybill->getWeightByType(Application_Model_WeightType::LastVolume)>$this->waybill->getWeightByType(Application_Model_WeightType::LastWeight))?true:false;
                                ?>
                                <?php if($this->waybill->getWeightByType(Application_Model_WeightType::LastWeight) || $this->waybill->getWeightByType(Application_Model_WeightType::LastVolume)){
                                    echo ($this->waybill->IsVolume?($LastIsVolume?$this->waybill->getWeightByType(Application_Model_WeightType::LastVolume):$this->waybill->getWeightByType(Application_Model_WeightType::LastVolume)):$this->waybill->getWeightByType(Application_Model_WeightType::LastWeight)).'g';
                                    echo '<span>'.($this->waybill->IsVolume?($LastIsVolume?' (按体积重量)':'（按实际重量）'):'（按实际重量）').'</span>';
                                }else{
                                    echo '<i>等待发包测量</i>';
                                }
                                ?>
                                </td>
                            	<td class="l1">实际支付金额：</td>
                            	<td class="l2"><em><?= $this->waybill->LastMoney?'￥'.$this->waybill->LastMoney:'<i>待定</i>' ?></em><?= $this->waybill->RefundMoney?"<strong>(退款￥". $this->waybill->RefundMoney .")</strong>":'' ?> </td>
                            </tr>
                        </table>
                    </div>
                    <div class="wayname"><div class="whinfo"><h2>物流跟踪 <a href="<?= $this->waybill->ExpressBy->WebUrl ?>" target="_blank" style="font-size:12px;">(<?= $this->waybill->ExpressBy->Name ?>官网查询)</a></h2></div></div>
                    <div class="genzong">
                        <? if(count($this->waybill->getLogisticsItems())==0 && $this->waybill->Logistics ==NULL){
                            echo '<div class="mingxi"> 暂无物流跟踪信息</div>';
                        } ?>
                        <table>
                            <?foreach($this->waybill->getLogisticsItems() as $item){ ?>
                            <tr>
                                <td class="gz"><?= $item->OpDate ?></td>
                                <td><?= $item->OpRemark ?></td>
                            </tr>
                            <? } ?>
                        </table>                                
                        <?
                        if($this->waybill->Logistics != NULL && $this->waybill->Logistics!='')
                            {
                        ?>
                        <style>
                            .mingxi a{color:#005aa0}
                            .mingxi a:hover{text-decoration:underline}
                        </style>
                    	<table>
                        	<tr>
                                <td> 
                            <div class="mingxi">
                                    物流状态加载中...
                            </div>
                            <script type="text/javascript">
                            $(function(){
                                $.post('/member/getexpress', {'id':<?= $this->waybill->Id ?>,'type':'2'}, function(data){
                                    if(data.isUrl!="0"){
                                        var html = '<iframe name="kuaidi100" src="'+data.content+'" width="600" height="380" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no"></iframe>';
                                        $('.mingxi').html(html);
                                    }else{
                                        $('.mingxi').html(data.content);
                                    }

                                }, 'json');
                            })
                            </script>
                                </td>
                            </tr>
                        </table>
                        <? } ?>
                    </div>
                </div>
                <div class="kucunlist">
                    <div class="wayname"><h2>运单货物详情</h2></div>
                    <div class="qingdan">
                    	<table>
                            <tr>
                            	<th class="o1">仓库单号</th>
                                <th class="o2">名称</th>
                                <th class="o3">重量(g)</th>
                                <th class="o4">体积重量</th>
                            </tr>
                            <?php 
                            $items=$this->waybill->getStoreItems();
                                //var_dump($items);
                            foreach ($items as $item){ ?>
                            
                            <tr>
                                <td class="o1"><?= substr($item->Barcode,3) ?></td>
                                <td class="o2">
                                    <div class="whpic">
                                        <a href="<?= $this->cdn ?><?= is_file('big'.$item->imageFile)?('/big'.$item->imageFile):($item->imageFile) ?>" target="_blank"><img src="<?= $this->cdn ?><?php echo $item->imageFile; ?>" alt="<?php echo $item->productName; ?>" /></a>
                                    </div>
                                    <div class="whinfo">
                                        <h2><a href="<?= "/member/storedetail?storeid=".$item->Id ?>"><?= $item->RemarkName?$item->RemarkName:$item->ProductName;?></a></h2>
                                        <div class="wh_add">
                                            <p>来源:<?= $item->Logistics ?></p>
                                        </div>
                                    </div>
                                </td>
                                <td class="o3"><?php echo $item->weight;?></td>
                                <td class="o4"><?= $item->VolumeWeight?$item->VolumeWeight.'g':'(无)'; ?></td>
                            </tr>                            
                            <?php 
                            }
                            ?>
                           
                        </table>
                    </div>
                </div>
                
            </div>

        </div>
    </div>
</div>
<div class="tanchuang" <?php echo $this->ma?($this->ma==1?"":'style="display:none;"'):'style="display:none;"';?>>
    <div class="nui-msgbox">
        <div class="nui-msgbox-hd">问题包裹</div>
        <a class="nui-msgbox-close" title="关闭"><b></b></a>
    </div>
    <div class="wt_top">
    	<div class="wt_nav">
            <ul>
                <li class="wt_on"><a href="javascript:void(0)" id="problem">问题沟通</a></li>
                <li ><a href="javascript:void(0)" id="dispose">处理与进度</a></li>
            </ul>
        </div>
    </div>
    <div class="wenti_box">
        <div class="wt_center">
            <?php 
                if($this->issuedetail){
                    foreach($this->issuedetail as $problemVal){ ?>
                    <div class="<?php echo $problemVal->issuetype == 1?"wt_uuch":"wt_kehu"; ?>">
                        <h2><?php echo $problemVal->issuetype == 1?"悠奇客服":'回复人：'; ?>
                            <span><?php echo $problemVal->dateCreated;?></span></h2>
                        <p><?php echo $problemVal->content;?></p>
                    </div>
            <?php } } ?>
        </div>
        <?php if($this->waybill->problem != Application_Model_wayBillItem::Problem_Cancel && $this->waybill->Status == Application_Model_wayBillItem::STATUS_ExpressBack){ ?>
        <form method="post" action="/member/affirmproblem/id/<?php echo $this->waybill->id; ?>" id="formproblem">
            <div class="wt_caozuo">
                <textarea name="content" cols="" rows="" id="content"></textarea><a class="wt_liuyan" href="javascript:void(0)"><span>留言</span></a>
            </div>
        </form>
	<?php } ?>
    </div>
    <div class="wenti_box2" style="display:none;">
    	<div class="jinduck">
        	<h2>问题处理进度：</h2>
        </div>
        <div class="wenti_jindu">
            <table>
            	<?php 
                if($this->scheduledetail){
                    foreach($this->scheduledetail as $key => $operateVal){ ?>
                    <tr <?php echo $key==0?'class="jd_on"':"";?>>
                        <td class="wtjd_z"><p><?php echo $operateVal->dateCreated;?><i></i></p></td>
                        <td><?php echo $operateVal->content;?></td>
                    </tr>
                <?php } }?>
            </table>
        </div>
        <div class="wtgb">
        	<a class="button1" href="javascript:void(0)" id='exitproblem'><span>关闭</span></a>
        </div>
	</div>

</div>
<div class="houtai_overlay" <?php echo $this->ma?($this->ma==1?"":'style="display:none;"'):'style="display:none;"';?>></div>
<script>
    $(".waybillQR").click(function(){
        var id = $(this).attr("name");
        if(confirm("您确认该国际运单您已经签收了？","提示信息")){   
            location.href = "/member/waybill?oper=sign&id="+id;
        }
    });
    $("#problem_houtai").live("click",function(){
        $("div.houtai_overlay").attr("style","display:block;");
        $("div.tanchuang").attr("style","display:block;");
    });
    $(".nui-msgbox-close").live("click",function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $("div.tanchuang").attr("style","display:none;");
    });
    $("#exitproblem").live("click",function(){
        $("div.houtai_overlay").attr("style","display:none;");
        $("div.tanchuang").attr("style","display:none;");
    });
    $("#problem").live("click",function(){
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box2").attr("style","display:none");
        $(".wenti_box").attr("style","display:block");
    });
    $("#dispose").live("click",function(){
        $(".wt_nav ul li").attr("class","");
        $(this).parents("li").attr("class","wt_on");
        $(".wenti_box").attr("style","display:none");
        $(".wenti_box2").attr("style","display:block");
    });
    $(".wt_liuyan").live("click",function(){
        var content = $("#content").val();
        if(content == ""){
            alert("原因内容不能为空");
            return false;
        }else{
            $("#formproblem").submit();
            return false;
        }
    });
</script>
